package consul

import (
	"fmt"
	capi "github.com/hashicorp/consul/api"
)

func Consul() {
	client, err := capi.NewClient(&capi.Config{
		Address:    "121.36.228.151",
		PathPrefix: "http",
	})
	if err != nil {
		panic(err)
	}
	agent := client.Agent()
	err = agent.ServiceRegister(&capi.AgentServiceRegistration{
		ID:      "server",
		Name:    "1234",
		Tags:    []string{"rpc"},
		Port:    8500,
		Address: "127.0.0.1",
	})
	if err != nil {
		return
	}
	fmt.Println("注册成功：：")

}
